<div ng-controller="memberCtrl">
  <div class="row margin-b-30 text-center">
    <h1>会员管理 <a class="mousehand" data-toggle="modal" data-target="#addMemberModel"><img ng-src="assets/images/addMember.png"><!-- <span class="glyphicon glyphicon-plus-sign"></span> --></a></h1>
    <div class="modal fade" id="addMemberModel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                  <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                  <h3 class="modal-title" id="myModalLabel">添加会员</h3>
                </div>
                <div class="modal-body">
                    <div class="row">
                      <div class="col-sm-8 col-sm-offset-2 text-left member-body">
                        <div class="row">
                          <div class="input-group ">
                              <input type="text" class="form-control" placeholder="请输入姓名" ng-model='add_member.name'/>
                              <div class="input-group-addon">
                                <span class="glyphicon glyphicon-user"></span>
                              </div>
                          </div>   
                        </div>
                        <div class="row">
                          <div class="input-group">
                              <input type="text" class="form-control" placeholder="请输入电话" ng-model='add_member.phone'/>
                              <div class="input-group-addon">
                                <span class="glyphicon glyphicon-phone"></span>
                              </div>
                          </div>
                        </div>
                        <div class="row">
                          <div class="input-group">
                              <input type="text" class="form-control" placeholder="充值" ng-model='add_member.stored_money'/>
                              <div class="input-group-addon">
                                <span class="glyphicon glyphicon-usd"></span>
                              </div>
                          </div>
                        </div>
                        <div class="row">
                              <input type="submit" value="保存" class="btn btn-primary btn-lg" ng-click="addMember()" style="width: 100%;">
                        </div>
                      </div>
                    </div>
                    
                </div>
            </div>
        </div>
    </div>
  </div>
  <div class="row">
    <div class="col-sm-10 col-sm-offset-1">
        <div class="table-responsive">
            <table class="table tableFilter table-hover table-striped">
              <thead>
                <tr>
                   <th><h4>姓名</h4></th>
                   <th><h4>手机号码</h4></th>
                   <th><h4>累计消费</h4></th>
                   <th><h4>储值</h4></th>
                   <th><h4>入会时间</h4></th>
                   <th><h4>操作</h4></th>
                </tr>
              </thead>
              <tbody>
                  <tr ng-repeat="x in member_form" class="formalign">
                      <td>
                        <h4><small>{{x.name}}</small></h4>
                      </td>
                      <td>
                        <h4><small>{{x.phone}}</small></h4>
                      </td>
                      <td>
                        <h4><small>{{x.grand_total}}</small></h4>
                      </td>
                      <td>
                        <h4><small>{{x.stored_money}}</small></h4>
                      </td>
                      <td>
                        <h4><small>{{x.time}}</small></h4>
                      </td>
                      <td>
                        <div class="cart-buttons">
                          <a type="button" class="btn btn-primary btn-xg" data-toggle="modal" data-target="#memberModal" ng-click="editMember($index)">编辑</a>
                          <a type="button" class="btn btn-dark btn-xg" ng-click="removeMember($index)">删除</a>
                        </div>
                        <!-- Modal -->
                        <div class="modal fade" id="memberModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                            <div class="modal-dialog" role="document">
                                <div class="modal-content">
                                    <div class="modal-header">
                                      <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                      <h3 class="modal-title" id="myModalLabel">会员管理</h3>
                                    </div>
                                    <div class="modal-body">
                                        <div class="row">
                                          <div class="col-sm-8 col-sm-offset-2 text-left member-body">
                                            <div class="row">
                                              <label>姓名</label>
                                              <div class="input-group ">
                                                  <input type="text" class="form-control" placeholder="姓名" ng-model='edit_member.name'/>
                                                  <div class="input-group-addon">
                                                    <span class="glyphicon glyphicon-user"></span>
                                                  </div>
                                              </div>   
                                            </div>
                                            <div class="row">
                                              <label>电话</label>
                                              <div class="input-group">
                                                  <input type="text" class="form-control" placeholder="电话" ng-model='edit_member.phone'/>
                                                  <div class="input-group-addon">
                                                    <span class="glyphicon glyphicon-phone"></span>
                                                  </div>
                                              </div>
                                            </div>
                                            <div class="row">
                                              <label>充值</label>
                                              <div class="input-group">
                                                  <input type="text" class="form-control" placeholder="储值" ng-model='edit_member.recharge'/>
                                                  <div class="input-group-addon">
                                                    <span class="glyphicon glyphicon-usd"></span>
                                                  </div>
                                              </div>
                                            </div>
                                            <div class="row">
                                                  <input type="submit" value="保存" class="btn btn-primary btn-lg" ng-click="updateMember(member)" style="width: 100%;">
                                            </div>
                                          </div>
                                        </div>
                                        
                                    </div>
                                </div>
                            </div>
                        </div>
                      </td>
                  </tr>
              </tbody>
            </table>                  
        </div><!--end cart table-->
    </div>
  </div> 
</div>

